package com.bountytask.util;

import lombok.NoArgsConstructor;

@Deprecated
@NoArgsConstructor
public class Result<T> {
    public static Integer status;
    public static String message;
    public  T data;

    public static Result OK(){
        Result r1 = new Result();
        status=Status.OK.getCode();
        message=Status.OK.getMessage();
        return r1;
    }

    //系统异常调用此方法
    public static Result NotFound(){
        Result r1 = new Result();
        status=Status.NotFound.getCode();
        message=Status.NotFound.getMessage();
        return r1;
    }

    //SQL语句异常调用此方法
    public static Result  Fail(){
        Result r1 = new Result();
        status=Status.Fail.getCode();
        message=Status.Fail.getMessage();
        return r1;
    }

    public static Result ForbiddenAccess(){
        Result r1 = new Result();
        status=Status.Forbidden_Access.getCode();
        message=Status.Forbidden_Access.getMessage();
        return r1;
    }

    //传数据的方法
    public Result data(T data){
        this.data= data;
        return this;
    }

}
